// https://umijs.org/config/
import { defineConfig } from 'umi';
import defaultSettings from './defaultSettings';
import proxy from './proxy';

const { REACT_APP_ENV } = process.env;

export default defineConfig({
  hash: true,
  antd: {},
  dva: {
    hmr: true,
  },
  locale: {
    // default zh-CN
    default: 'zh-CN',
    // default true, when it is true, will use `navigator.language` overwrite default
    antd: true,
    baseNavigator: true,
  },
  dynamicImport: {
    loading: '@/components/PageLoading/index',
  },
  title: false,
  targets: {
    ie: 11,
  },
  // umi routes: https://umijs.org/docs/routing
  routes: [
    {
      name: 'sign-in',
      path: '/login',
      component: '../layouts/UserLayout',
      routes: [
        {
          path: '/login',
          component: './user/login',
        },
        {
          component: './404',
        },
      ],
    },
    {
      routes: [
        {
          path: '/',
          component: '../layouts/BasicLayout',
          routes: [
            {
              path: '/',
              name: 'home',
              icon: 'smile',
              component: './dashboard/analysis',
            },
            {
              name: 'auth',
              path: '/auth',
              icon: 'lock',
              routes: [
                {
                  path: '/auth/group',
                  name: 'auth-group',
                  icon: 'team',
                  component: './auth-group',
                },
                {
                  path: '/auth/module',
                  name: 'auth-module',
                  icon: 'appstore',
                  component: './auth-module',
                },
                {
                  path: '/auth/user',
                  name: 'auth-user',
                  icon: 'user',
                  component: './auth-user',
                },
              ],
            },
            {
              path: '/order',
              name: 'order',
              icon: 'project',
              routes: [
                {
                  path: '/order/list',
                  name: 'order-list',
                  icon: 'ordered-list',
                  component: './order-list',
                },
                {
                  path: '/order/detail/:id',
                  name: 'order-detail',
                  icon: 'ordered-list',
                  component: './order-list/detail',
                },
              ],
            },

            {
              path: '/goods',
              name: 'goods',
              icon: 'shop',
              routes: [
                {
                  path: '/goods/list',
                  name: 'goods-list',
                  icon: 'shopping',
                  component: './goods/goods-list',
                },
                {
                  path: '/goods/create/:id?',
                  name: 'goods-create',
                  icon: 'plus-square',
                  component: './goods/goods-list/create',
                },
                {
                  path: '/goods/category',
                  name: 'goods-category',
                  icon: 'tags',
                  component: './goods/category',
                },
                {
                  path: '/goods/attr',
                  name: 'goods-attr',
                  icon: 'tablet',
                  component: './goods/attr',
                },
                {
                  path: '/goods/market',
                  name: 'goods-market',
                  icon: 'fire',
                  component: './goods/market',
                },
                {
                  path: '/goods/type',
                  name: 'goods-type',
                  icon: 'carry-out',
                  component: './goods/goods-type',
                },
                {
                  path: '/goods/keywords',
                  name: 'keywords',
                  icon: 'key',
                  component: './goods/keywords',
                },
              ],
            },
            {
              path: '/pic',
              name: 'picture',
              icon: 'file-protect',
              routes: [
                {
                  path: '/pic/carousel',
                  name: 'carousel-list',
                  icon: 'picture',
                  component: './pic/carousel',
                },
              ],
            },
            {
              path: '/shop',
              name: 'shop',
              icon: 'shop',
              routes: [
                {
                  path: '/shop/list',
                  name: 'shop-list',
                  icon: 'shopping',
                  component: './shop/list',
                },
                {
                  path: '/shop/llogw',
                  name: 'shop-list',
                  icon: 'shopping',
                  component: './shop/list',
                },
              ],
            },
            {
              path: '/sys',
              name: 'sys',
              icon: 'setting',
              routes: [
                {
                  path: '/sys/site',
                  name: 'sys-site',
                  icon: 'global',
                  component: './sys/site',
                },
              ],
            },
            {
              path: '/merchant',
              name: 'merchant',
              icon: 'book',
              routes: [
                {
                  path: '/merchant/app',
                  name: 'merchant-app',
                  icon: 'api',
                  component: './merchant/app',
                },
                {
                  path: '/merchant/nav',
                  name: 'merchant-nav',
                  icon: 'flag',
                  component: './merchant/nav',
                },
                {
                  path: '/merchant/notice',
                  name: 'merchant-notice',
                  icon: 'flag',
                  component: './merchant/notice',
                },
                {
                  path: '/merchant/qr',
                  name: 'merchant-qr',
                  icon: 'qrcode',
                  component: './merchant/qr',
                },
              ],
            },
            {
              path: '/store',
              name: 'store',
              icon: 'setting',
              routes: [
                {
                  path: '/store',
                  name: 'setting',
                  icon: 'smile',
                  component: './store',
                },
                {
                  path: '/store/furnish/:tplId/:pageId',
                  name: 'furnish',
                  icon: 'smile',
                  component: './store/furnish',
                },
              ],
            },
            {
              path: '/marketing',
              name: 'marketing',
              icon: 'table',
              routes: [
                {
                  path: '/marketing/tool',
                  name: 'furnish',
                  icon: 'fire',
                  routes: [
                    {
                      path: '/marketing/tool',
                      name: 'furnish',
                      icon: 'fire',
                      component: './marketing/tool',
                      hideInMenu: true,
                    },
                    {
                      path: '/marketing/tool/aiText',
                      name: 'furnish',
                      icon: 'fire',
                      component: './marketing/aiText',
                      hideInMenu: true,
                    },
                    {
                      path: '/marketing/tool/aiImage',
                      name: 'furnish',
                      icon: 'fire',
                      component: './marketing/aiImage',
                      hideInMenu: true,
                    },
                    {
                      path: '/marketing/tool/aiVideo',
                      name: 'furnish',
                      icon: 'fire',
                      component: './marketing/aiVideo',
                      hideInMenu: true,
                    },
                  ]
                },
                {
                  path: '/marketing/interactive',
                  name: 'interactive',
                  icon: 'crown',
                  component: './marketing/interactive',
                  // hideInMenu: true,
                },
                {
                  path: '/marketing/coupon',
                  name: 'couponList',
                  icon: 'table',
                  component: './marketing/coupon',
                },
              ],
            },
            {
              name: 'list.table-list',
              icon: 'table',
              path: '/list',
              component: './ListTableList',
            },
            // {
            //   path: '/sms',
            //   name: 'sms',
            //   icon: 'file-protect',
            //   routes: [
            //     {
            //       path: '/sms/coupon/list',
            //       name: 'fruit-apply',
            //       icon: 'picture',
            //       component: './sms/coupon',
            //     },
            //   ]
            // },
            {
              component: './404',
            },
          ],
        },
        {
          component: './404',
        },
      ],
    },
    {
      component: './404',
    },
  ],
  // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  theme: {
    // ...darkTheme,
    'primary-color': defaultSettings.primaryColor,
  },
  ignoreMomentLocale: true,
  proxy: proxy[REACT_APP_ENV || 'dev'],
  manifest: {
    basePath: '/',
  },

 
});
